
#ifndef _MATERIAL_HT0020_H_
#define _MATERIAL_HT0020_H_

#include "stdint.h"


typedef union
{
	struct
	{
	
	};
	
	uint8_t data[4];

}STR_MATERIAL_CMD;



typedef union
{
	struct
	{
		uint8_t head;
		uint8_t index;
		uint8_t sort;
		uint8_t X1_amp_H;
		uint8_t X1_amp_L;
		uint8_t X1_pos_H;
		uint8_t X1_pos_L;
		uint8_t X2_amp_H;
		uint8_t X2_amp_L;
		uint8_t X2_pos_H;
		uint8_t X2_pos_L;
		uint8_t X3_amp_H;
		uint8_t X3_amp_L;
		uint8_t X3_pos_H;
		uint8_t X3_pos_L;
		uint8_t X4_amp_H;
		uint8_t X4_amp_L;
		uint8_t X4_pos_H;
		uint8_t X4_pos_L;
		uint8_t checsum;
	};
	
	uint8_t data[20];

}STR_MATERIAL_DAT;


typedef struct
{
	uint8_t send_start;
	uint8_t send_cnt;
	uint8_t send_finish;
	
	uint8_t *cmd_buf;

}STR_MATERIAL_CTRL;


typedef enum
{
	M_HEAD,
	M_DATA,
	M_CHECK,
	M_ERRO,
	M_OVERTIME

}ENUM_ANALY_FMS;


typedef struct
{
	ENUM_ANALY_FMS FSM;
	
	STR_MATERIAL_DAT buf;
	uint16_t data_sum;
	
	uint8_t floor_sort;
	uint8_t rec_cnt;
	
	uint16_t rec_msg_cnt;

}STR_MATERIAL_ANALY;

extern STR_MATERIAL_ANALY material_analysis;

extern void material_cmd_send(void);
extern void material_data_analysis(void);

#endif

